/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaces.Interfaz1;

import controller.Game;
import controller.Network;
import java.io.IOException;
import java.awt.BorderLayout;

public class VentanaPrincipal extends javax.swing.JFrame {
    Game juego;

    /**
     * Creates new form VentanaPrincipal
     */
    public VentanaPrincipal(Game juegoselec) {
        juego = juegoselec;
        initComponents();
        PanelFondoPrincipal F = new PanelFondoPrincipal();
        this.setResizable(false);
        this.add(F,BorderLayout.CENTER);
        this.pack();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BotonJuegoNuevo = new javax.swing.JButton();
        BotonTopTen = new javax.swing.JButton();
        BotonSudokusEnLinea = new javax.swing.JButton();
        BotonReglasDelJuego = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sudoku Intense");
        setPreferredSize(new java.awt.Dimension(1000, 800));

        BotonJuegoNuevo.setBackground(new java.awt.Color(51, 51, 255));
        BotonJuegoNuevo.setFont(new java.awt.Font("Segoe Print", 1, 18)); // NOI18N
        BotonJuegoNuevo.setForeground(new java.awt.Color(204, 204, 255));
        BotonJuegoNuevo.setText("Juego Nuevo");
        BotonJuegoNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonJuegoNuevoActionPerformed(evt);
            }
        });

        BotonTopTen.setBackground(new java.awt.Color(51, 51, 255));
        BotonTopTen.setFont(new java.awt.Font("Segoe Print", 1, 18)); // NOI18N
        BotonTopTen.setForeground(new java.awt.Color(204, 204, 255));
        BotonTopTen.setText("Top Ten");
        BotonTopTen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonTopTenActionPerformed(evt);
            }
        });

        BotonSudokusEnLinea.setBackground(new java.awt.Color(51, 51, 255));
        BotonSudokusEnLinea.setFont(new java.awt.Font("Segoe Print", 1, 18)); // NOI18N
        BotonSudokusEnLinea.setForeground(new java.awt.Color(204, 204, 255));
        BotonSudokusEnLinea.setText("Sudokus En Linea");
        BotonSudokusEnLinea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonSudokusEnLineaActionPerformed(evt);
            }
        });

        BotonReglasDelJuego.setBackground(new java.awt.Color(51, 51, 255));
        BotonReglasDelJuego.setFont(new java.awt.Font("Segoe Print", 1, 18)); // NOI18N
        BotonReglasDelJuego.setForeground(new java.awt.Color(204, 204, 255));
        BotonReglasDelJuego.setText("Reglas del Juego");
        BotonReglasDelJuego.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonReglasDelJuegoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(712, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BotonSudokusEnLinea, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(BotonJuegoNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                        .addComponent(BotonTopTen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(BotonReglasDelJuego, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(59, 59, 59))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(117, 117, 117)
                .addComponent(BotonJuegoNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(82, 82, 82)
                .addComponent(BotonSudokusEnLinea, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(82, 82, 82)
                .addComponent(BotonReglasDelJuego, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(82, 82, 82)
                .addComponent(BotonTopTen, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(45, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BotonJuegoNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonJuegoNuevoActionPerformed
        VentanaNivel ventana = new VentanaNivel(juego);
        show(false);
        ventana.show();
    }//GEN-LAST:event_BotonJuegoNuevoActionPerformed

    private void BotonTopTenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonTopTenActionPerformed
        VentanaTopTen ventanaTop = new VentanaTopTen(this);
        setVisible(false);
        ventanaTop.setVisible(true);
        
        
    }//GEN-LAST:event_BotonTopTenActionPerformed

    private void BotonReglasDelJuegoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonReglasDelJuegoActionPerformed
        try {Network.ayudaWeb();} catch (IOException e) {System.out.println("ERROR EN LA CONEXION");}
    }//GEN-LAST:event_BotonReglasDelJuegoActionPerformed

    private void BotonSudokusEnLineaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonSudokusEnLineaActionPerformed
        String direccion = Network.elegirHttpJuegos();
        try {Network.irDirHttp(direccion);} catch (IOException e) {System.out.println("ERROR EN LA CONEXION");}
    }//GEN-LAST:event_BotonSudokusEnLineaActionPerformed

    /**
     * @param args the command line arguments
     */

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonJuegoNuevo;
    private javax.swing.JButton BotonReglasDelJuego;
    private javax.swing.JButton BotonSudokusEnLinea;
    private javax.swing.JButton BotonTopTen;
    // End of variables declaration//GEN-END:variables
}
